<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 7.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha256-wiz7ZSCn/btzhjKDQBms9Hx4sSeUYsDrTLg7roPstac=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.css" integrity="sha256-6cQIC71/iBIYXFK+0RHAvwmjwWzkWd+r7v/BX3/vZDc=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/green/pace-theme-minimal.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"sumumm.github.io","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.19.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"mac"},"fold":{"enable":true,"height":300},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":true,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="本文主要是VSCode用户自定义代码片段相关笔记，不区分平台，不管是win还是linux中的VScode均可使用。若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:type" content="article">
<meta property="og:title" content="LV02-01-用户代码片段.md">
<meta property="og:url" content="https://sumumm.github.io/post/de11d04e.html">
<meta property="og:site_name" content="苏木">
<meta property="og:description" content="本文主要是VSCode用户自定义代码片段相关笔记，不区分平台，不管是win还是linux中的VScode均可使用。若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://sumumm.github.io/MyLinux/00MyNotes/Software/VScode-02-%E7%94%A8%E6%88%B7%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5.assets/image-20220424185124770.png">
<meta property="og:image" content="https://sumumm.github.io/MyLinux/00MyNotes/Software/VScode-02-%E7%94%A8%E6%88%B7%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5.assets/image-20220424185212371.png">
<meta property="og:image" content="https://sumumm.github.io/MyLinux/00MyNotes/Software/VScode-02-%E7%94%A8%E6%88%B7%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5.assets/image-20220425185212371.png">
<meta property="article:published_time" content="2023-07-02T06:55:12.000Z">
<meta property="article:modified_time" content="2025-06-13T16:25:57.067Z">
<meta property="article:author" content="苏木">
<meta property="article:tag" content="VScode">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://sumumm.github.io/MyLinux/00MyNotes/Software/VScode-02-%E7%94%A8%E6%88%B7%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5.assets/image-20220424185124770.png">


<link rel="canonical" href="https://sumumm.github.io/post/de11d04e.html">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://sumumm.github.io/post/de11d04e.html","path":"post/de11d04e.html","title":"LV02-01-用户代码片段.md"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>LV02-01-用户代码片段.md | 苏木</title>
  








    <script src="/js/browser_tools_disable.js"></script>

  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<!-- hexo injector head_end start --><link rel="stylesheet" href="https://unpkg.com/hexo-next-tags-plus@latest/lib/tag_plus.css" media="defer" onload="this.media='all'"><!-- hexo injector head_end end --></head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">苏木</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">我的学习之路</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>苏木的家</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类页<span class="badge">42</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档页<span class="badge">673</span></a></li><li class="menu-item menu-item-flink"><a href="/flink/" rel="section"><i class="fa fa-link fa-fw"></i>友人帐</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于我</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81%E4%BB%A3%E7%A0%81%E6%AE%B5"><span class="nav-text">一、代码段</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E6%89%93%E5%BC%80%E7%9B%B8%E5%85%B3%E6%96%87%E4%BB%B6"><span class="nav-text">1. 打开相关文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E4%BB%A3%E7%A0%81%E6%AE%B5%E4%BD%9C%E7%94%A8%E5%9F%9F"><span class="nav-text">2. 代码段作用域</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E4%B9%A6%E5%86%99%E8%AF%B4%E6%98%8E"><span class="nav-text">3. 书写说明</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E9%A2%84%E5%AE%9A%E4%B9%89%E5%8F%98%E9%87%8F"><span class="nav-text">3. 预定义变量</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-%E5%8F%98%E9%87%8F%E4%BD%BF%E7%94%A8%E5%89%8D%E7%9A%84%E7%BC%96%E8%BE%91"><span class="nav-text">4. 变量使用前的编辑</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81%E5%BC%80%E5%90%AF%E8%A1%A5%E5%85%A8%E5%8A%9F%E8%83%BD"><span class="nav-text">二、开启补全功能</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%89%E3%80%81%E6%88%91%E7%9A%84%E5%B8%B8%E7%94%A8%E4%BB%A3%E7%A0%81%E6%AE%B5"><span class="nav-text">三、我的常用代码段</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-C%E8%AF%AD%E8%A8%80"><span class="nav-text">1. C语言</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-c-json"><span class="nav-text">1. c.json</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-2-settings-json"><span class="nav-text">1.2 settings.json</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-ARM"><span class="nav-text">2. ARM</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-arm-json"><span class="nav-text">2.2 arm.json </span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-settings-json"><span class="nav-text">2.2 settings.json</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-C"><span class="nav-text">3. C++</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-1-cpp-json"><span class="nav-text">3.1 cpp.json </span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-3-settings-json"><span class="nav-text">3.3 settings.json</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-Makefile"><span class="nav-text">4. Makefile</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#4-1-makefile-json"><span class="nav-text">4.1 makefile.json </span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-2-settings-json"><span class="nav-text">4.2 settings.json</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-ShellScript"><span class="nav-text">5. ShellScript</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#5-1-shellscript-json"><span class="nav-text">5.1 shellscript.json </span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-2-settings-json-1"><span class="nav-text">4.2 settings.json</span></a></li></ol></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="苏木"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">苏木</p>
  <div class="site-description" itemprop="description">莫道桑榆晚，为霞尚满天</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">673</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">42</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">43</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/sumumm" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;sumumm" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://sumumm.github.io/post/de11d04e.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="苏木">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苏木">
      <meta itemprop="description" content="莫道桑榆晚，为霞尚满天">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="LV02-01-用户代码片段.md | 苏木">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          LV02-01-用户代码片段.md
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2023-07-02 14:55:12" itemprop="dateCreated datePublished" datetime="2023-07-02T14:55:12+08:00">2023-07-02</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/" itemprop="url" rel="index"><span itemprop="name">开发工具</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/01VScode/" itemprop="url" rel="index"><span itemprop="name">01VScode</span></a>
        </span>
    </span>

  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>3.6k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>13 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><p>本文主要是VSCode用户自定义代码片段相关笔记，不区分平台，不管是win还是linux中的VScode均可使用。若笔记中有错误或者不合适的地方，欢迎批评指正😃。</p>
<span id="more"></span>

<!-- Photo: https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/01VScode/LV02-01-%E7%94%A8%E6%88%B7%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/img/ -->

<details class="folding-tag" blue><summary> 点击查看使用工具及版本 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center" rowspan="5">PC端开发环境</td>        <td align="center" width=150px>Windows</td>        <td align="left">Windows11</td>    </tr>    <tr>        <td align="center">Ubuntu</td>        <td align="left">Ubuntu20.04.6的64位版本（一开始使用的是16.04版本，后来进行了升级）</td>      </tr>    <tr>        <td align="center">VMware® Workstation 17 Pro</td>        <td align="left">17.0.0 build-20800274</td>      </tr>    <tr>        <td align="center">终端软件</td>        <td align="left">MobaXterm(Professional Edition v23.0 Build 5042 (license))</td>    </tr>    <tr>        <td align="center">Win32DiskImager</td>        <td align="left">Win32DiskImager v1.0</td>      </tr>    <tr>        <td align="center" rowspan="3">Linux开发板环境</td>        <td align="center">Linux开发板</td>        <td align="left">正点原子 i.MX6ULL Linux 阿尔法开发板</td>      </tr>    <tr>        <td align="center">uboot</td>        <td align="left">NXP官方提供的uboot，NXP提供的版本为uboot-imx-rel_imx_4.1.15_2.1.0_ga(使用的uboot版本为U-Boot 2016.03)</td>      </tr>    <tr>        <td align="center">linux内核</td>        <td align="left">linux-4.15(NXP官方提供)</td>      </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看本文参考资料 </summary>
              <div class='content'>
              <table>    <tr><td align="center">参考资料  </td><td align="center">相关链接</td></tr>    <tr><td align="left">VS Code官网</td><td align="left"><a href="https://code.visualstudio.com/" target="_blank">Visual Studio Code - Code Editing. Redefined  <i class="fa fa-external-link-alt"></i> </a></td></tr>    <tr><td align="left">VS Code历史版本</td><td align="left"><a href="https://code.visualstudio.com/updates/v1_69" target="_blank">Visual Studio Code (历史版本下载)  <i class="fa fa-external-link-alt"></i> </a></td></tr>    <tr><td align="left">VS Code官方文档</td><td align="left"><a href="https://code.visualstudio.com/docs" target="_blank">Getting Started  <i class="fa fa-external-link-alt"></i> </a></td></tr>    <tr><td align="left">工作区相关说明</td><td align="left"><a href="https://code.visualstudio.com/docs/editor/workspaces" target="_blank">Workspaces in Visual Studio Code  <i class="fa fa-external-link-alt"></i> </a></td></tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看相关文件下载 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">---</td>        <td align="left">--- <a href="" target="_blank">  <i class="fa fa-external-link-alt"></i></a></td>      </tr></table>
              </div>
            </details>

<h1 id="一、代码段"><a href="#一、代码段" class="headerlink" title="一、代码段"></a><font size=3>一、代码段</font></h1><h2 id="1-打开相关文件"><a href="#1-打开相关文件" class="headerlink" title="1. 打开相关文件"></a><font size=3>1. 打开相关文件</font></h2><p>我们首先肯定需要打开自定义代码段设置啦，我们打开自己想要配置的编程语言的自定义代码片段的定义文件，可以从这里打开：</p>
<img data-src="../../../MyLinux/00MyNotes/Software/VScode-02-用户代码片段.assets/image-20220424185124770.png" alt="image-20220424185124770" style="zoom:33%;" />

<p>然后会在顶栏看到如下选项：</p>
<img data-src="../../../MyLinux/00MyNotes/Software/VScode-02-用户代码片段.assets/image-20220424185212371.png" alt="image-20220424185212371" style="zoom:33%;" />

<p>选中自己想要配置的编程语言就可以啦，我这里选的是 C 语言的，然后便会打开一个空的配置文件，里边的内容如下：</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line">	<span class="comment">// Place your snippets for c here. Each snippet is defined under a snippet name and has a prefix, body and </span></span><br><span class="line">	<span class="comment">// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:</span></span><br><span class="line">	<span class="comment">// $1, $2 for tab stops, $0 for the final cursor position, and $&#123;1:label&#125;, $&#123;2:another&#125; for placeholders. Placeholders with the </span></span><br><span class="line">	<span class="comment">// same ids are connected.</span></span><br><span class="line">	<span class="comment">// Example:</span></span><br><span class="line">	<span class="comment">// &quot;Print to console&quot;: &#123;</span></span><br><span class="line">	<span class="comment">// 	&quot;prefix&quot;: &quot;log&quot;,</span></span><br><span class="line">	<span class="comment">// 	&quot;body&quot;: [</span></span><br><span class="line">	<span class="comment">// 		&quot;console.log(&#x27;$1&#x27;);&quot;,</span></span><br><span class="line">	<span class="comment">// 		&quot;$2&quot;</span></span><br><span class="line">	<span class="comment">// 	],</span></span><br><span class="line">	<span class="comment">// 	&quot;description&quot;: &quot;Log output to console&quot;</span></span><br><span class="line">	<span class="comment">// &#125;</span></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>

<p>上边的是啥？我们后边再解释。</p>
<h2 id="2-代码段作用域"><a href="#2-代码段作用域" class="headerlink" title="2. 代码段作用域"></a><font size=3>2. 代码段作用域</font></h2><p>从上边的图中，我们看到有三类选项，一类是各种文件类型，一类是新建 “DirName” 代码片段，还有一类是全局代码片段。这些选项新建出来的自定义代码片段文件语法以及内容都是一样的，只不过<strong>作用域不同</strong>罢了。它们最终生成的代码片段文件都将存于以下目录中：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">全局作用域和特定文件类型作用域 类型的自定义代码片段</span></span><br><span class="line">Windows下在C:\Users\username\AppData\Roaming\Code\User\snippets</span><br><span class="line">Linux下在:~/.config/Code/User/snippets</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">文夹件作用域 类型的自定义代码片段(工作区中的.vscode目录)</span></span><br><span class="line">./.vscode</span><br></pre></td></tr></table></figure>

<ul>
<li>全局作用域</li>
</ul>
<p>这种类型自定义代码片段是全局生效的，相当于是创建在 VScode 软件内部的文件。不管是哪个工作区，哪种文件，只要是在这个软件中打开的文件，都会有效。</p>
<ul>
<li>特定文件类型作用域</li>
</ul>
<p>这种类型的定义代码片段跟全局作用域的文件路径是一致的，都是创建在了 VS Code 中，会一直存在。但是这种代码块只适合于指定的文件类型。</p>
<ul>
<li>文件夹作用域</li>
</ul>
<p>这种类型的自定义代码片段是创建在某个文件下 .vscode 这个隐藏文件夹中的，这个代码块只适用于当前文件夹，出了这个文件夹这个代码片段文件就失效了。</p>
<h2 id="3-书写说明"><a href="#3-书写说明" class="headerlink" title="3. 书写说明"></a><font size=3>3. 书写说明</font></h2><p>先来看一下官方的例子：</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line">	<span class="comment">// Place your snippets for c here. Each snippet is defined under a snippet name and has a prefix, body and </span></span><br><span class="line">	<span class="comment">// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:</span></span><br><span class="line">	<span class="comment">// $1, $2 for tab stops, $0 for the final cursor position, and $&#123;1:label&#125;, $&#123;2:another&#125; for placeholders. Placeholders with the </span></span><br><span class="line">	<span class="comment">// same ids are connected.</span></span><br><span class="line">	<span class="comment">// Example:</span></span><br><span class="line">	<span class="comment">// &quot;Print to console&quot;: &#123;</span></span><br><span class="line">	<span class="comment">// 	&quot;prefix&quot;: &quot;log&quot;,</span></span><br><span class="line">	<span class="comment">// 	&quot;body&quot;: [</span></span><br><span class="line">	<span class="comment">// 		&quot;console.log(&#x27;$1&#x27;);&quot;,</span></span><br><span class="line">	<span class="comment">// 		&quot;$2&quot;</span></span><br><span class="line">	<span class="comment">// 	],</span></span><br><span class="line">	<span class="comment">// 	&quot;description&quot;: &quot;Log output to console&quot;</span></span><br><span class="line">	<span class="comment">// &#125;</span></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>

<table>
    <tr>
        <td align="center" width=150px>Print to console</td>
        <td align="left">自定义代码段的名称。</td>
    </tr>
    <tr>
        <td align="center" width=150px>scope</td>
        <td align="left">代码片段的作用文件类型，这里我们可以指定文件类型，多种类型之间用逗号隔开。</td>
    </tr>
    <tr>
        <td align="center" width=150px>prefix</td>
        <td align="left">触发代码块的字符串。输入这里的字符串后就会产生提示，选中后按下Tab就可以自动替换为自定义的代码片段。</td>
    </tr>
    <tr>
        <td align="center" width=150px>body</td>
        <td align="left">代码片段的主体内容，就是我们要插入的内容格式。</td>
    </tr>
    <tr>
        <td align="center" width=150px>description</td>
        <td align="left">代码片段描述。</td>
    </tr>
    <tr>
        <td align="center" width=150px>$0</td>
        <td align="left">表示光标最终位置。</td>
    </tr>
    <tr>
        <td align="center" width=150px>$1, $2, ...</td>
        <td align="left">$1 表示使用代码块敲击回车或者 tab 键后光标定位的位置。<br>$2 $3 $4…表示我们按下tab光标依次出现的位置。</td>
    </tr>
</table>


<p>【注意】</p>
<p>（1）每个字符串元素就代表一行，行与行之间用 ,  隔开表示换行。或者使用 \n 换行。</p>
<p>（2）行内不能使用 tab 键缩进，只能使用空格 &lt;space&gt; 或者 \t 表示缩进。</p>
<h2 id="3-预定义变量"><a href="#3-预定义变量" class="headerlink" title="3. 预定义变量"></a><font size=3>3. 预定义变量</font></h2><p>类似于上边 $1 和 $2 这种，是 VS Code 内部自己定义的变量，我们可以直接引用。</p>
<details class="folding-tag" blue><summary> 点击查看常见预定义变量 </summary>
              <div class='content'>
              <figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">文件相关</span><br><span class="line">TM_SELECTED_TEXT 当前选定的文本或空字符串； </span><br><span class="line">TM_CURRENT_LINE：当前行的内容； </span><br><span class="line">TM_CURRENT_WORD：光标所处单词或空字符串 </span><br><span class="line">TM_LINE_INDEX：行号（从零开始）； </span><br><span class="line">TM_LINE_NUMBER：行号（从一开始）； </span><br><span class="line">TM_FILENAME：当前文档的文件名； </span><br><span class="line">TM_FILENAME_BASE：当前文档的文件名（不含后缀名）； </span><br><span class="line">TM_DIRECTORY：当前文档所在目录； </span><br><span class="line">TM_FILEPATH：当前文档的完整文件路径； </span><br><span class="line">时间相关</span><br><span class="line">CURRENT_YEAR<span class="punctuation">:</span> 当前年份； </span><br><span class="line">CURRENT_YEAR_SHORT<span class="punctuation">:</span> 当前年份的后两位； </span><br><span class="line">CURRENT_MONTH<span class="punctuation">:</span> 格式化为两位数字的当前月份，如 <span class="number">02</span>； </span><br><span class="line">CURRENT_MONTH_NAME<span class="punctuation">:</span> 当前月份的全称，如 July； </span><br><span class="line">CURRENT_MONTH_NAME_SHORT<span class="punctuation">:</span> 当前月份的简称，如 Jul； </span><br><span class="line">CURRENT_DATE<span class="punctuation">:</span> 当天月份第几天，如 <span class="number">08</span>； </span><br><span class="line">CURRENT_DAY_NAME<span class="punctuation">:</span> 当天周几，如 Monday； </span><br><span class="line">CURRENT_DAY_NAME_SHORT<span class="punctuation">:</span> 当天周几的简称，如 Mon； </span><br><span class="line">CURRENT_HOUR<span class="punctuation">:</span> 当前小时（<span class="number">24</span> 小时制）； </span><br><span class="line">CURRENT_MINUTE<span class="punctuation">:</span> 当前分钟； </span><br><span class="line">CURRENT_SECOND<span class="punctuation">:</span> 当前秒数。 </span><br><span class="line">CLIPBOARD：当前剪贴板中内容。</span><br></pre></td></tr></table></figure><p>更多的也可以查看官方文档的这一节：<a target="_blank" rel="noopener" href="https://code.visualstudio.com/docs/editor/userdefinedsnippets#_create-your-own-snippets">Snippets in Visual Studio Code <i class="fa fa-external-link-alt"></i></a></p>
              </div>
            </details>

<p>一般使用格式如下：</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$Name</span><br><span class="line">或者</span><br><span class="line">$<span class="punctuation">&#123;</span>Name<span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>

<h2 id="4-变量使用前的编辑"><a href="#4-变量使用前的编辑" class="headerlink" title="4. 变量使用前的编辑"></a><font size=3>4. 变量使用前的编辑</font></h2><p>这一部分可以参考这里：<a target="_blank" rel="noopener" href="https://code.visualstudio.com/docs/editor/userdefinedsnippets#_transform-examples">Snippets in Visual Studio Code——Transform examples  <i class="fa fa-external-link-alt"></i></a></p>
<p> 这里根据官方文档，以文件 example-123.456-TEST.js 为例：</p>
<table>
<thead>
<tr>
<th align="left">Example</th>
<th align="left">Output</th>
<th align="left">Explanation</th>
</tr>
</thead>
<tbody><tr>
<td align="left"><code>&quot;$&#123;TM_FILENAME/[\\.]/_/&#125;&quot;</code></td>
<td align="left">example-123_456-TEST.js</td>
<td align="left">Replace the first  .  with  _</td>
</tr>
<tr>
<td align="left"><code>&quot;$&#123;TM_FILENAME/[\\.-]/_/g&#125;&quot;</code></td>
<td align="left">example_123_456_TEST_js</td>
<td align="left">Replace each  .  or  -  with  _</td>
</tr>
<tr>
<td align="left"><code>&quot;$&#123;TM_FILENAME/(.*)/$&#123;1:/upcase&#125;/&#125;&quot;</code></td>
<td align="left">EXAMPLE-123.456-TEST.JS</td>
<td align="left">Change to all uppercase</td>
</tr>
<tr>
<td align="left"><code>&quot;$&#123;TM_FILENAME/[^0-9^a-z]//gi&#125;&quot;</code></td>
<td align="left">example123456TESTjs</td>
<td align="left">Remove non-alphanumeric characters</td>
</tr>
</tbody></table>
<h1 id="二、开启补全功能"><a href="#二、开启补全功能" class="headerlink" title="二、开启补全功能"></a><font size=3>二、开启补全功能</font></h1><p>接下来就是开启相关的功能了，我们可以去设置中打开 settings.json ，注意这里其实是可能有三个这样的文件的，如果有创建的话，一个应该是位于当前目录下的 .vscode （不管是 win 还是 Linux 都是）目录下，这个配置文件的优先级会高于另外一个，但是这里的不能用 VScode 自带的同步功能进行同步。另一个配置文件是可以通过 VScode 自动进行同步的，在 win 下一般位于 C:\Users&lt;username&gt;\AppData\Roaming\Code\User ，在 Linux 中一般位于 ~&#x2F;.config&#x2F;Code&#x2F;User 中。还有一种是如果保存了工作区的话，可以创建一个工作区配置文件。我一般是喜欢用第二种，因为可以同步，换了电脑同步一下就可以啦。</p>
<p>那怎么打开呢？按下 Ctrl + Shift + p 即可打开设置搜索窗口，输入 settings.json 会有下图提示：</p>
<img data-src="../../../MyLinux/00MyNotes/Software/VScode-02-用户代码片段.assets/image-20220425185212371.png" alt="iimage-20220425185212371" style="zoom:33%;" />

<p>打开文件后，按照语法格式添加以下内容（我用 C 语言较多，这里我就只配置了 C ）：</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">&quot;editor.quickSuggestions&quot;</span><span class="punctuation">:</span><span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;comments&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;strings&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;other&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span></span><br><span class="line"><span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"><span class="comment">//用户代码片段触发</span></span><br><span class="line"><span class="attr">&quot;[c]&quot;</span><span class="punctuation">:</span><span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;editor.quickSuggestions&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">        <span class="attr">&quot;comments&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span><span class="punctuation">,</span></span><br><span class="line">        <span class="attr">&quot;strings&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span><span class="punctuation">,</span></span><br><span class="line">        <span class="attr">&quot;other&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span></span><br><span class="line">    <span class="punctuation">&#125;</span></span><br><span class="line"><span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br></pre></td></tr></table></figure>

<h1 id="三、我的常用代码段"><a href="#三、我的常用代码段" class="headerlink" title="三、我的常用代码段"></a><font size=3>三、我的常用代码段</font></h1><h2 id="1-C语言"><a href="#1-C语言" class="headerlink" title="1. C语言"></a><font size=3>1. C语言</font></h2><h3 id="1-c-json"><a href="#1-c-json" class="headerlink" title="1. c.json"></a><font size=3>1. c.json</font></h3><details class="folding-tag" blue><summary> 点击查看 c.json 配置 </summary>
              <div class='content'>
              <figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line">	<span class="comment">// Place your snippets for c here. Each snippet is defined under a snippet name and has a prefix, body and </span></span><br><span class="line">	<span class="comment">// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:</span></span><br><span class="line">	<span class="comment">// $1, $2 for tab stops, $0 for the final cursor position, and $&#123;1:label&#125;, $&#123;2:another&#125; for placeholders. Placeholders with the </span></span><br><span class="line">	<span class="comment">// same ids are connected.</span></span><br><span class="line">	<span class="comment">// Example:</span></span><br><span class="line">	<span class="comment">// &quot;Print to console&quot;: &#123;</span></span><br><span class="line">	<span class="comment">// 	&quot;prefix&quot;: &quot;log&quot;,</span></span><br><span class="line">	<span class="comment">// 	&quot;body&quot;: [</span></span><br><span class="line">	<span class="comment">// 		&quot;console.log(&#x27;$1&#x27;);&quot;,</span></span><br><span class="line">	<span class="comment">// 		&quot;$2&quot;</span></span><br><span class="line">	<span class="comment">// 	],</span></span><br><span class="line">	<span class="comment">// 	&quot;description&quot;: &quot;Log output to console&quot;</span></span><br><span class="line">	<span class="comment">// &#125;</span></span><br><span class="line">	<span class="attr">&quot;head&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">		<span class="attr">&quot;prefix&quot;</span><span class="punctuation">:</span> <span class="string">&quot;head&quot;</span><span class="punctuation">,</span> <span class="comment">// 触发的关键字 输入 head 按下tab键</span></span><br><span class="line">		<span class="attr">&quot;body&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">			<span class="string">&quot;$BLOCK_COMMENT_START* =====================================================&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Copyright © hk. 2022-2025. All rights reserved.&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * File name  : $&#123;TM_FILENAME&#125;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Author     : 上上签&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Date       : $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Version    : &quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Description: &quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * ======================================================&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; $BLOCK_COMMENT_END&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line">		<span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line">		<span class="attr">&quot;description&quot;</span><span class="punctuation">:</span> <span class="string">&quot;Description at the beginning of file!&quot;</span></span><br><span class="line">	<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">	<span class="attr">&quot;main&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">		<span class="attr">&quot;prefix&quot;</span><span class="punctuation">:</span> <span class="string">&quot;main&quot;</span><span class="punctuation">,</span> <span class="comment">// 触发的关键字 输入 main 按下tab键</span></span><br><span class="line">		<span class="attr">&quot;body&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">			<span class="string">&quot;#include &lt;stdio.h&gt;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;int main(int argc, const char *argv[])&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;&#123;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;    /* code */ &quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;    &quot;</span><span class="punctuation">,</span>  <span class="comment">// $1 表示输入触发关键字后，按下 Tab 后光标定位到的第一个位置</span></span><br><span class="line">			<span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;    return 0;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;&#125;&quot;</span><span class="punctuation">,</span></span><br><span class="line">		<span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line">		<span class="attr">&quot;description&quot;</span><span class="punctuation">:</span> <span class="string">&quot;main function!&quot;</span></span><br><span class="line">	<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">	<span class="attr">&quot;mainh&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">		<span class="attr">&quot;prefix&quot;</span><span class="punctuation">:</span> <span class="string">&quot;mainh&quot;</span><span class="punctuation">,</span> <span class="comment">// 触发的关键字 输入 mainh 按下tab键</span></span><br><span class="line">		<span class="attr">&quot;body&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">			<span class="string">&quot;#ifndef __$&#123;TM_FILENAME/(.*)\\..+$/$&#123;1:/upcase&#125;/&#125;_H__&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;#define __$&#123;TM_FILENAME/(.*)\\..+$/$&#123;1:/upcase&#125;/&#125;_H__&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;#endif $BLOCK_COMMENT_START __$&#123;TM_FILENAME/(.*)\\..+$/$&#123;1:/upcase&#125;/&#125;_H__ $BLOCK_COMMENT_END&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;&quot;</span></span><br><span class="line">		<span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line">		<span class="attr">&quot;description&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span></span><br><span class="line">	<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">	<span class="attr">&quot;func&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">		<span class="attr">&quot;prefix&quot;</span><span class="punctuation">:</span> <span class="string">&quot;func&quot;</span><span class="punctuation">,</span>  <span class="comment">// 触发的关键字 输入func按下tab键</span></span><br><span class="line">		<span class="attr">&quot;body&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">			<span class="string">&quot;$BLOCK_COMMENT_START*&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;  * @brief  &quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;  * @note   &quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;  * @param  &quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;  * @retval &quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;  $BLOCK_COMMENT_END&quot;</span><span class="punctuation">,</span> <span class="comment">// $1 表示输入触发关键字后，按下 Tab 后光标定位到的第一个位置</span></span><br><span class="line">		<span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line">		<span class="attr">&quot;description&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span></span><br><span class="line">	<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">	<span class="attr">&quot;desc&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">		<span class="attr">&quot;prefix&quot;</span><span class="punctuation">:</span> <span class="string">&quot;desc&quot;</span><span class="punctuation">,</span>  <span class="comment">// 触发的关键字 输入desc按下tab键</span></span><br><span class="line">		<span class="attr">&quot;body&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">			<span class="string">&quot;/** $0 */&quot;</span><span class="punctuation">,</span>  </span><br><span class="line">		<span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line">		<span class="attr">&quot;description&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span></span><br><span class="line">	<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>
              </div>
            </details>

<h3 id="1-2-settings-json"><a href="#1-2-settings-json" class="headerlink" title="1.2 settings.json"></a><font size=3>1.2 settings.json</font></h3><details class="folding-tag" blue><summary> settings.json </summary>
              <div class='content'>
              <figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">&quot;editor.quickSuggestions&quot;</span><span class="punctuation">:</span><span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;comments&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;strings&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;other&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span></span><br><span class="line"><span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"><span class="comment">//用户代码片段触发</span></span><br><span class="line"><span class="attr">&quot;[c]&quot;</span><span class="punctuation">:</span><span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;editor.quickSuggestions&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">        <span class="attr">&quot;comments&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span><span class="punctuation">,</span></span><br><span class="line">        <span class="attr">&quot;strings&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span><span class="punctuation">,</span></span><br><span class="line">        <span class="attr">&quot;other&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span></span><br><span class="line">    <span class="punctuation">&#125;</span></span><br><span class="line"><span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br></pre></td></tr></table></figure>
              </div>
            </details>

<h2 id="2-ARM"><a href="#2-ARM" class="headerlink" title="2. ARM"></a><font size=3>2. ARM</font></h2><h3 id="2-2-arm-json"><a href="#2-2-arm-json" class="headerlink" title="2.2 arm.json "></a><font size=3>2.2 arm.json </font></h3><details class="folding-tag" blue><summary> 点击查看 arm.json 配置 </summary>
              <div class='content'>
              <figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line">	<span class="comment">// Place your snippets for arm here. Each snippet is defined under a snippet name and has a prefix, body and </span></span><br><span class="line">	<span class="comment">// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:</span></span><br><span class="line">	<span class="comment">// $1, $2 for tab stops, $0 for the final cursor position, and $&#123;1:label&#125;, $&#123;2:another&#125; for placeholders. Placeholders with the </span></span><br><span class="line">	<span class="comment">// same ids are connected.</span></span><br><span class="line">	<span class="comment">// Example:</span></span><br><span class="line">	<span class="comment">// &quot;Print to console&quot;: &#123;</span></span><br><span class="line">	<span class="comment">// 	&quot;prefix&quot;: &quot;log&quot;,</span></span><br><span class="line">	<span class="comment">// 	&quot;body&quot;: [</span></span><br><span class="line">	<span class="comment">// 		&quot;console.log(&#x27;$1&#x27;);&quot;,</span></span><br><span class="line">	<span class="comment">// 		&quot;$2&quot;</span></span><br><span class="line">	<span class="comment">// 	],</span></span><br><span class="line">	<span class="comment">// 	&quot;description&quot;: &quot;Log output to console&quot;</span></span><br><span class="line">	<span class="comment">// &#125;</span></span><br><span class="line">	<span class="attr">&quot;head&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">		<span class="attr">&quot;prefix&quot;</span><span class="punctuation">:</span> <span class="string">&quot;head&quot;</span><span class="punctuation">,</span> <span class="comment">// 触发的关键字, 输入后按下tab键</span></span><br><span class="line">		<span class="attr">&quot;body&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">			<span class="string">&quot;$BLOCK_COMMENT_START* =====================================================&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Copyright © hk. 2022-2025. All rights reserved.&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * File name: $&#123;TM_FILENAME&#125;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Author   : 上上签&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Date     : $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Version  : &quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Description: &quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * ======================================================&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; $BLOCK_COMMENT_END&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;$0&quot;</span><span class="punctuation">,</span></span><br><span class="line">		<span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line">		<span class="attr">&quot;description&quot;</span><span class="punctuation">:</span> <span class="string">&quot;Description at the beginning of file&quot;</span></span><br><span class="line">	<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">	<span class="attr">&quot;desc&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">		<span class="attr">&quot;prefix&quot;</span><span class="punctuation">:</span> <span class="string">&quot;desc&quot;</span><span class="punctuation">,</span> <span class="comment">// 触发的关键字, 输入后按下tab键</span></span><br><span class="line">		<span class="attr">&quot;body&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">			<span class="string">&quot;$BLOCK_COMMENT_START*&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Description: &quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; $BLOCK_COMMENT_END&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;$1&quot;</span><span class="punctuation">,</span></span><br><span class="line">		<span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line">		<span class="attr">&quot;description&quot;</span><span class="punctuation">:</span> <span class="string">&quot;Description!&quot;</span></span><br><span class="line">	<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>
              </div>
            </details>

<h3 id="2-2-settings-json"><a href="#2-2-settings-json" class="headerlink" title="2.2 settings.json"></a><font size=3>2.2 settings.json</font></h3><details class="folding-tag" blue><summary> settings.json </summary>
              <div class='content'>
              <figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">&quot;editor.quickSuggestions&quot;</span><span class="punctuation">:</span><span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;comments&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;strings&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;other&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span></span><br><span class="line"><span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"><span class="comment">//用户代码片段触发</span></span><br><span class="line"><span class="attr">&quot;[arm]&quot;</span><span class="punctuation">:</span><span class="punctuation">&#123;</span></span><br><span class="line">        <span class="attr">&quot;editor.quickSuggestions&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">            <span class="attr">&quot;comments&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;strings&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;other&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span></span><br><span class="line">        <span class="punctuation">&#125;</span></span><br><span class="line"><span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br></pre></td></tr></table></figure>
              </div>
            </details>

<h2 id="3-C"><a href="#3-C" class="headerlink" title="3. C++"></a><font size=3>3. C++</font></h2><h3 id="3-1-cpp-json"><a href="#3-1-cpp-json" class="headerlink" title="3.1 cpp.json "></a><font size=3>3.1 cpp.json </font></h3><p>这部分配置目前还主要是针对 .h 文件，不清楚为啥，这个文件被归入了 cpp ，所以就在这里添加常用代码段啦。</p>
<details class="folding-tag" blue><summary> 点击查看 cpp.json 配置 </summary>
              <div class='content'>
              <figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line">	<span class="comment">// Place your snippets for cpp here. Each snippet is defined under a snippet name and has a prefix, body and </span></span><br><span class="line">	<span class="comment">// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:</span></span><br><span class="line">	<span class="comment">// $1, $2 for tab stops, $0 for the final cursor position, and $&#123;1:label&#125;, $&#123;2:another&#125; for placeholders. Placeholders with the </span></span><br><span class="line">	<span class="comment">// same ids are connected.</span></span><br><span class="line">	<span class="comment">// Example:</span></span><br><span class="line">	<span class="comment">// &quot;Print to console&quot;: &#123;</span></span><br><span class="line">	<span class="comment">// 	&quot;prefix&quot;: &quot;log&quot;,</span></span><br><span class="line">	<span class="comment">// 	&quot;body&quot;: [</span></span><br><span class="line">	<span class="comment">// 		&quot;console.log(&#x27;$1&#x27;);&quot;,</span></span><br><span class="line">	<span class="comment">// 		&quot;$2&quot;</span></span><br><span class="line">	<span class="comment">// 	],</span></span><br><span class="line">	<span class="comment">// 	&quot;description&quot;: &quot;Log output to console&quot;</span></span><br><span class="line">	<span class="comment">// &#125;</span></span><br><span class="line">	<span class="attr">&quot;head&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">		<span class="attr">&quot;prefix&quot;</span><span class="punctuation">:</span> <span class="string">&quot;head&quot;</span><span class="punctuation">,</span> <span class="comment">// 触发的关键字 输入 head 按下tab键</span></span><br><span class="line">		<span class="attr">&quot;body&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">			<span class="string">&quot;$BLOCK_COMMENT_START* =====================================================&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Copyright © hk. 2022-2025. All rights reserved.&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * File name  : $&#123;TM_FILENAME&#125;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Author     : 上上签&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Date       : $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Version    : &quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * Description: &quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; * ======================================================&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot; $BLOCK_COMMENT_END&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line">		<span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line">		<span class="attr">&quot;description&quot;</span><span class="punctuation">:</span> <span class="string">&quot;Description at the beginning of file!&quot;</span></span><br><span class="line">	<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">	<span class="attr">&quot;main&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">		<span class="attr">&quot;prefix&quot;</span><span class="punctuation">:</span> <span class="string">&quot;main&quot;</span><span class="punctuation">,</span> <span class="comment">// 触发的关键字 输入 main 按下tab键</span></span><br><span class="line">		<span class="attr">&quot;body&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">			<span class="string">&quot;#include &lt;stdio.h&gt;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;int main(int argc, const char *argv[])&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;&#123;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;    /* code */ &quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;    &quot;</span><span class="punctuation">,</span>  <span class="comment">// $1 表示输入触发关键字后，按下 Tab 后光标定位到的第一个位置</span></span><br><span class="line">			<span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;    return 0;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;&#125;&quot;</span><span class="punctuation">,</span></span><br><span class="line">		<span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line">		<span class="attr">&quot;description&quot;</span><span class="punctuation">:</span> <span class="string">&quot;main function!&quot;</span></span><br><span class="line">	<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">	<span class="attr">&quot;mainh&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">		<span class="attr">&quot;prefix&quot;</span><span class="punctuation">:</span> <span class="string">&quot;mainh&quot;</span><span class="punctuation">,</span> <span class="comment">// 触发的关键字 输入 mainh 按下tab键</span></span><br><span class="line">		<span class="attr">&quot;body&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">			<span class="string">&quot;#ifndef __$&#123;TM_FILENAME/(.*)\\..+$/$&#123;1:/upcase&#125;/&#125;_H__&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;#define __$&#123;TM_FILENAME/(.*)\\..+$/$&#123;1:/upcase&#125;/&#125;_H__&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;#endif $BLOCK_COMMENT_START __$&#123;TM_FILENAME/(.*)\\..+$/$&#123;1:/upcase&#125;/&#125;_H__ $BLOCK_COMMENT_END&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;&quot;</span></span><br><span class="line">		<span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line">		<span class="attr">&quot;description&quot;</span><span class="punctuation">:</span> <span class="string">&quot;&quot;</span></span><br><span class="line">	<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>
              </div>
            </details>

<h3 id="3-3-settings-json"><a href="#3-3-settings-json" class="headerlink" title="3.3 settings.json"></a><font size=3>3.3 settings.json</font></h3><details class="folding-tag" blue><summary> settings.json </summary>
              <div class='content'>
              <figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">&quot;editor.quickSuggestions&quot;</span><span class="punctuation">:</span><span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;comments&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;strings&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;other&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span></span><br><span class="line"><span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"><span class="comment">//用户代码片段触发</span></span><br><span class="line"><span class="attr">&quot;[cpp]&quot;</span><span class="punctuation">:</span><span class="punctuation">&#123;</span></span><br><span class="line">        <span class="attr">&quot;editor.quickSuggestions&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">            <span class="attr">&quot;comments&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;strings&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;other&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span></span><br><span class="line">        <span class="punctuation">&#125;</span></span><br><span class="line"><span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br></pre></td></tr></table></figure>
              </div>
            </details>

<h2 id="4-Makefile"><a href="#4-Makefile" class="headerlink" title="4. Makefile"></a><font size=3>4. Makefile</font></h2><h3 id="4-1-makefile-json"><a href="#4-1-makefile-json" class="headerlink" title="4.1 makefile.json "></a><font size=3>4.1 makefile.json </font></h3><details class="folding-tag" blue><summary> 点击查看 makefile.json 配置 </summary>
              <div class='content'>
              <figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line">	<span class="comment">// Place your snippets for makefile here. Each snippet is defined under a snippet name and has a prefix, body and </span></span><br><span class="line">	<span class="comment">// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:</span></span><br><span class="line">	<span class="comment">// $1, $2 for tab stops, $0 for the final cursor position, and $&#123;1:label&#125;, $&#123;2:another&#125; for placeholders. Placeholders with the </span></span><br><span class="line">	<span class="comment">// same ids are connected.</span></span><br><span class="line">	<span class="comment">// Example:</span></span><br><span class="line">	<span class="comment">// &quot;Print to console&quot;: &#123;</span></span><br><span class="line">	<span class="comment">// 	&quot;prefix&quot;: &quot;log&quot;,</span></span><br><span class="line">	<span class="comment">// 	&quot;body&quot;: [</span></span><br><span class="line">	<span class="comment">// 		&quot;console.log(&#x27;$1&#x27;);&quot;,</span></span><br><span class="line">	<span class="comment">// 		&quot;$2&quot;</span></span><br><span class="line">	<span class="comment">// 	],</span></span><br><span class="line">	<span class="comment">// 	&quot;description&quot;: &quot;Log output to console&quot;</span></span><br><span class="line">	<span class="comment">// &#125;</span></span><br><span class="line">	<span class="attr">&quot;head&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">		<span class="attr">&quot;prefix&quot;</span><span class="punctuation">:</span> <span class="string">&quot;head&quot;</span><span class="punctuation">,</span> <span class="comment">// 触发的关键字, 输入后按下tab键</span></span><br><span class="line">		<span class="attr">&quot;body&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">			<span class="string">&quot;##============================================================================#&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;# Copyright © hk. 2022-2025. All rights reserved.&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;# File name: $&#123;TM_FILENAME&#125;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;# Author   : 上上签&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;# Date     : $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;# Version  : &quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;# Description: &quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;##============================================================================#&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;##&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;$0&quot;</span><span class="punctuation">,</span></span><br><span class="line">		<span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line">		<span class="attr">&quot;description&quot;</span><span class="punctuation">:</span> <span class="string">&quot;Description at the beginning of file&quot;</span></span><br><span class="line">	<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>
              </div>
            </details>

<h3 id="4-2-settings-json"><a href="#4-2-settings-json" class="headerlink" title="4.2 settings.json"></a><font size=3>4.2 settings.json</font></h3><details class="folding-tag" blue><summary> settings.json </summary>
              <div class='content'>
              <figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">&quot;editor.quickSuggestions&quot;</span><span class="punctuation">:</span><span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;comments&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;strings&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;other&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span></span><br><span class="line"><span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"><span class="comment">//用户代码片段触发</span></span><br><span class="line"><span class="attr">&quot;[makefile]&quot;</span><span class="punctuation">:</span><span class="punctuation">&#123;</span></span><br><span class="line">        <span class="attr">&quot;editor.quickSuggestions&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">            <span class="attr">&quot;comments&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;strings&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span><span class="punctuation">,</span></span><br><span class="line">            <span class="attr">&quot;other&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span></span><br><span class="line">        <span class="punctuation">&#125;</span></span><br><span class="line"><span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br></pre></td></tr></table></figure>
              </div>
            </details>

<h2 id="5-ShellScript"><a href="#5-ShellScript" class="headerlink" title="5. ShellScript"></a><font size=3>5. ShellScript</font></h2><h3 id="5-1-shellscript-json"><a href="#5-1-shellscript-json" class="headerlink" title="5.1 shellscript.json "></a><font size=3>5.1 shellscript.json </font></h3><details class="folding-tag" blue><summary> 点击查看 shellscript.json 配置 </summary>
              <div class='content'>
              <figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line">	<span class="comment">// Place your snippets for shellscript here. Each snippet is defined under a snippet name and has a prefix, body and </span></span><br><span class="line">	<span class="comment">// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:</span></span><br><span class="line">	<span class="comment">// $1, $2 for tab stops, $0 for the final cursor position, and $&#123;1:label&#125;, $&#123;2:another&#125; for placeholders. Placeholders with the </span></span><br><span class="line">	<span class="comment">// same ids are connected.</span></span><br><span class="line">	<span class="comment">// Example:</span></span><br><span class="line">	<span class="comment">// &quot;Print to console&quot;: &#123;</span></span><br><span class="line">	<span class="comment">// 	&quot;prefix&quot;: &quot;log&quot;,</span></span><br><span class="line">	<span class="comment">// 	&quot;body&quot;: [</span></span><br><span class="line">	<span class="comment">// 		&quot;console.log(&#x27;$1&#x27;);&quot;,</span></span><br><span class="line">	<span class="comment">// 		&quot;$2&quot;</span></span><br><span class="line">	<span class="comment">// 	],</span></span><br><span class="line">	<span class="comment">// 	&quot;description&quot;: &quot;Log output to console&quot;</span></span><br><span class="line">	<span class="comment">// &#125;</span></span><br><span class="line">	<span class="attr">&quot;head&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">		<span class="attr">&quot;prefix&quot;</span><span class="punctuation">:</span> <span class="string">&quot;head&quot;</span><span class="punctuation">,</span> <span class="comment">// 触发的关键字 输入 head 按下tab键</span></span><br><span class="line">		<span class="attr">&quot;body&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">			<span class="string">&quot;#!/bin/bash&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;# * =====================================================&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;# * Copyright © hk. 2022-2025. All rights reserved.&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;# * File name  : $&#123;TM_FILENAME&#125;&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;# * Author     : 上上签&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;# * Date       : $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;# * ======================================================&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;##&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="string">&quot;&quot;</span><span class="punctuation">,</span></span><br><span class="line">		<span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line">		<span class="attr">&quot;description&quot;</span><span class="punctuation">:</span> <span class="string">&quot;Description at the beginning of file!&quot;</span></span><br><span class="line">	<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>
              </div>
            </details>

<h3 id="4-2-settings-json-1"><a href="#4-2-settings-json-1" class="headerlink" title="4.2 settings.json"></a><font size=3>4.2 settings.json</font></h3><details class="folding-tag" blue><summary> settings.json </summary>
              <div class='content'>
              <figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">&quot;editor.quickSuggestions&quot;</span><span class="punctuation">:</span><span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;comments&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;strings&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;other&quot;</span><span class="punctuation">:</span> <span class="string">&quot;off&quot;</span></span><br><span class="line"><span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"><span class="comment">//用户代码片段触发</span></span><br><span class="line"><span class="attr">&quot;[shellscript]&quot;</span><span class="punctuation">:</span><span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;editor.quickSuggestions&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">        <span class="attr">&quot;comments&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span><span class="punctuation">,</span></span><br><span class="line">        <span class="attr">&quot;strings&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span><span class="punctuation">,</span></span><br><span class="line">        <span class="attr">&quot;other&quot;</span><span class="punctuation">:</span> <span class="string">&quot;on&quot;</span></span><br><span class="line">    <span class="punctuation">&#125;</span></span><br><span class="line"><span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br></pre></td></tr></table></figure>
              </div>
            </details>

    </div>

    
    
    

    <footer class="post-footer">




    <div>
        
            <div style="text-align:center;color: #ccc;font-size:14px;">
            ----------本文结束
            <i class="fas fa-fan fa-spin" style="color: #FF1493; font-size: 1rem"></i>
            感谢您的阅读----------
            </div>
        
    </div>





  
  <div class="my_post_copyright"> 
    <p><span>文章标题:</span><a href="/post/de11d04e.html">LV02-01-用户代码片段.md</a></p>
    <p><span>文章作者:</span><a href="/" title="欢迎访问 《苏木》 的学习笔记">苏木</a></p>
    <p><span>发布时间:</span>2023年07月02日 - 14:55</p>
    <p><span>最后更新:</span>2025年06月14日 - 00:25</p>
    <p><span>原始链接:</span><a href="/post/de11d04e.html" title="LV02-01-用户代码片段.md">https://sumumm.github.io/post/de11d04e.html</a></p>
    <p><span>许可协议:</span><i class="fab fa-creative-commons"></i> <a rel="license" href= "https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
  </div>
  


          <div class="post-tags">
              <a href="/tags/VScode/" rel="tag"><i class="fa fa-tag"></i> VScode</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/a5bc098b.html" rel="prev" title="LV02-02-屏蔽工程文件.md">
                  <i class="fa fa-angle-left"></i> LV02-02-屏蔽工程文件.md
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/2238be1.html" rel="next" title="LV01-01-VScode简介与安装.md">
                  LV01-01-VScode简介与安装.md <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 2017 – 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">苏木</span>
  </div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">3.7m</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">225:26</span>
  </span>
</div>




    <span id="sitetime"></span>
    <script defer language=javascript>
        function siteTime()
        {
            window.setTimeout("siteTime()", 1000);
            var seconds = 1000;
            var minutes = seconds * 60;
            var hours = minutes * 60;
            var days = hours * 24;
            var years = days * 365;
            var today = new Date();
            var todayYear = today.getFullYear();
            var todayMonth = today.getMonth()+1;
            var todayDate = today.getDate();
            var todayHour = today.getHours();
            var todayMinute = today.getMinutes();
            var todaySecond = today.getSeconds();
            /*==================================================
            Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
            year        - 作为date对象的年份，为4位年份值
            month       - 0-11之间的整数，做为date对象的月份
            day         - 1-31之间的整数，做为date对象的天数
            hours       - 0(午夜24点)-23之间的整数，做为date对象的小时数
            minutes     - 0-59之间的整数，做为date对象的分钟数
            seconds     - 0-59之间的整数，做为date对象的秒数
            microseconds - 0-999之间的整数，做为date对象的毫秒数
            ==================================================*/
            var t1 = Date.UTC(2017, 
                              5, 
                              19, 
                              0, 
                              0, 
                              0); //北京时间
            var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
            var diff = t2-t1;
            var diffYears = Math.floor(diff/years);
            var diffDays = Math.floor((diff/days)-diffYears*365);
            var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
            var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
            var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
            document.getElementById("sitetime").innerHTML="已在这里 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
        }
        siteTime();
    </script>



    </div>
  </footer>

  
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.umd.js" integrity="sha256-ytMJGN3toR+a84u7g7NuHm91VIR06Q41kMWDr2pq7Zo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>




  <script src="/js/third-party/fancybox.js"></script>

  <script src="/js/third-party/pace.js"></script>


  




  

  <script class="next-config" data-name="enableMath" type="application/json">false</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


 
        <div id="click-show-text"
            data-mobile = false
            data-text = 富强,民主,文明,和谐,自由,平等,公正,法制,爱国,敬业,诚信,友善
            data-fontsize = 15px
            data-random= false>
        </div>
       

      
        <script async src=https://cdn.jsdelivr.net/npm/hexo-next-mouse-effect@latest/click/showText.js></script>
      

      
    




    <script async src="/js/fancybox_param.js"></script>





<!-- APlayer本体 -->



</body>
</html>
